package wassalt.Utils;

public interface AppConstants {

	/**
	 * Registration Constants
	 */
	public static final String SENDER_ID = "wassaltapp@gmail.com";
	public static final String ACCOUNT_NAME = "accountName";
	public static final String AUTH_COOKIE = "authCookie";
	public static final String CONNECTION_STATUS = "connectionStatus";
	public static final String CONNECTED = "connected";
	public static final String CONNECTING = "connecting";
	public static final String DISCONNECTED = "disconnected";
	public static final String DEVICE_REG_KEY = "deviceRegKey";

	public static final String FIRST_NAME_FIELD = "fistNameField";
	public static final String LAST_NAME_FIELD = "lastNameField";
	public static final String MAIL_FIELD_POS = "mailFieldPOS";
	public static final String PHONE_FIELD = "phoneField";
	public static final String START_DATE_PARAM = "start";
	public static final String END_DATE_PARAM = "end";
	public static final String PLACE_PARAM = "place";
	public static final String TYPE_PARAM = "type";
	public static final String WHEN_PARAM = "when";
	public static final String NTYPE_PARAM = "ntype";
	public static final String ID_OWNER_PARAM = "idOwner";

	// may or may not be set by the user later
	public static final String DEFAULT_LOC = "default_loc";

	/**
	 * Webservice URLs
	 */
	public static final String OFFERS_URL = "/ManageNotifications/getOutgoingOffersFrom";
	public static final String REQUESTS_URL = "/ManageNotifications/getIncomingRequestsFor";
	public static final String ALARM_URL = "/ManageNotifications/getAlarmsFor";
	public static final String DELETE_URL = "/ManageNotifications/deleteNotification";
	public static final String CANCEL_URL = "/ManageNotifications/cancelNotification";
	public static final String SETACCEPTED_URL = "/ManageNotifications/setAccepted";
	public static final String SETREJECTED_URL = "/ManageNotifications/setRejected";
	public static final String GETARRIVALS_URL = "/ManageNotifications/getArrivals";
	public static final String CHECK_URL = "/ManageNotifications/respondToRequest";

	/**
	 * C2DM Messages
	 */
	static final String WELCOME_MSG = "welcome";
	static final String NEW_ARRIVAL_MSG = "newArrival";
	static final String CHANGE_INCOMING_MSG = "changeIncoming";
	static final String CHANGE_OUTGOING_MSG = "changeOutgoing";
	static final String CHANGE_SELF_MSG = "changeSelf";
	static final String NEW_REQUEST_MSG = "newRequest";

	/**
	 * Notification Types
	 */
	int OFFER = 0;
	int REQUEST = 1;
	int ALARM = 2;
	/**
	 * User Data
	 */
	public static final String USER_ID = "id";
	public static final String FIRST_NAME = "firstName";
	public static final String LAST_NAME = "lastName";
	public static final String MAIL = "mail";
	public static final String PHONE = "phone";
	public static final String IS_REGISTERED = "is_registered";

	/**
	 * Filters
	 */
	public final String REGISTRATION_RESPONSE_FILTER = "reg_response";
	public final String C2DM_RESPONSE_FILTER = "c2dm_response";
	public final String REGISTRATION_UI_UPDATE_FILTER = "reg_ui_update";
	public final String HTTP_IN_FILTER = "HTTP_REFRESH_IN_FILTER";
	public final String HTTP_OUT_FILTER = "HTTP_REFRESH_OUT_FILTER";
	public final String HTTP_SELF_FILTER = "HTTP_REFRESH_SELF_FILTER";
	public final String HTTP_DELETE_FILTER = "HTTP_DELETE_FILTER";
	public final String HTTP_GETARRIVALS_FILTER = "HTTP_GETARRIVALS_FILTER";
	public final String HTTP_CHECK_FILTER = "HTTP_CHECK_FILTER";
	public final String HTTP_CANCEL_FILTER = "HTTP_CANCEL_FILTER";
	public final String HTTP_INSERT_OFFER_FILTER = "insert_offer";
	public final String HTTP_INSERT_REQUEST_FILTER = "insert_request";
	public final String UPDATE_TABLES = "update_tables";

	/**
	 * Server Responses
	 */
	public final String SERVER_STATUS = "status";
	public final String SERVER_SUCC = "sucess";
	public final String SERVER_FAIL = "fail";

	/**
	 * General Application constants
	 */
	// String SERVER_URL = "http://10.0.2.2:9000";
	// String SERVER_URL = "http://wassaltdev.appspot.com";
	static final String SHARED_PREFS = "WASSALT_PREFS";
	public static final String SHARED_PREFS_CON = "WASSALT_PREFS_CON";

	/**
	 * Permission Constants
	 */
	int ALWAYS_ALLOW = 0;
	int ALWAYS_ASK = 1;
	int NEVER_ALLOW = 2;

	/**
	 * Activity Identifiers
	 */
	int TAB_INCOMING = 0;
	int TAB_OUTGOING = 1;
	int TAB_SELF = 2;
	int FAVORITES = 3;
	int ALL = 4;

	/**
	 * Notification Status Identifiers
	 */
	String ACCEPTED = "Accepted";
	String REJECTED = "Rejected";
	String PENDING = "Pending";
	String URL = "URL";
	String HTTP_RESPONSE = "HTTP_RESPONSE";
	String HTTP_STATUS = "HTTP_STATUS";
	/**
	 * Success/Failure constants
	 */
	int SUCCESS = 1;
	int FAILURE = -1;
	final long ALREADY_EXISTS = -5;

	/**
	 * Menu Options
	 */
	int MENU_CANCEL = 0;
	int MENU_ACCEPT = 1;
	int MENU_REJECT = 2;
	int MENU_NEW = 3;
	int MENU_REFRESH = 4;
	int MENU_PERMISSIONS = 5;
	int MENU_DELETE = 6;
	int MENU_SELECT = 7;
	int MENU_DESELECT = 8;
	int MENU_SAVE = 9;

	/**
	 * Connect and disconnecting keys
	 */
	public static String REG_CON_KEY = "reg_trying";
	public static String OFFER_CON_KEY = "try_offer";
	public static String REQUEST_CON_KEY = "try_request";

	/**************** DATABASE VARIABLES ******************/

	/**
	 * Column names
	 */
	// Notification id
	final String ID = "id";
	// Other client's name
	final String CNAME = "cname";
	// Other client's phone
	final String CPHONE = "cphone";
	// Status of the notification accepted/rejected/pending
	final String STATUS = "status";
	// Start date/time of notification
	final String START = "start";
	// End date/time of notification
	final String END = "end";
	// Location of the notification
	final String LOCATION = "location";
	// Value to arrival
	final String VALUE = "value";
	// distance/time
	final String TYPE = "type";
	// id of notification at server-side
	final String NOT_ID = "notification_id";
	// type of notification requested/offered
	// true of requested false otherwise
	final String NOT_TYPE = "notification_type";
	// incoming/outgoing
	final String IN = "incoming";
	// time
	String TIME = "Time";
	// distance
	String DISTANCE = "Distance";
	final String CHECKED = "checked";
	/**
	 * Database properties
	 */
	final String DATABASE_NAME = "LocalDatabase";
	final String IN_TABLE = "Incoming";
	final String OUT_TABLE = "Outgoing";
	final String SELF_TABLE = "Self";
	final String CONTACTS_TABLE = "Contacts";
	final String NOTIFICATIONS_TABLE = "Notifications";
	final int DATABASE_VERSION = 9;
	/**
	 * SQL Queries
	 */
	final String SQL_CREATE = "CREATE TABLE IF NOT EXISTS ";
	final String TABLE_FIELDS = "( " + ID
			+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + CNAME
			+ " TEXT NOT NULL, " + STATUS + " TEXT NOT NULL," + START
			+ " TEXT, " + END + " TEXT, " + LOCATION + " TEXT, " + VALUE
			+ " TEXT, " + TYPE + " TEXT, " + NOT_ID + " TEXT NOT NULL, "
			+ NOT_TYPE + " BOOLEAN," + CPHONE + " TEXT );";

	final String SELF_FIELDS = "( " + ID
			+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + START + " TEXT, " + END
			+ " TEXT, " + LOCATION + " TEXT, " + VALUE + " TEXT, " + TYPE
			+ " TEXT, " + NOT_ID + " TEXT NOT NULL);";

	final String CONTACTS_FIELDS = "( " + ID
			+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + CNAME
			+ " TEXT NOT NULL, " + CPHONE + " TEXT NOT NULL);";

	final String NOTIFICATIONS_FIELDS = "( " + ID
			+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + CNAME + " TEXT, "
			+ CPHONE + " TEXT, " + LOCATION + " TEXT, " + VALUE + " TEXT, "
			+ TYPE + " TEXT, " + NOT_TYPE + " INTEGER);";

	final String DATABASE_CREATE_IN = SQL_CREATE + IN_TABLE + TABLE_FIELDS;
	final String DATABASE_CREATE_OUT = SQL_CREATE + OUT_TABLE + TABLE_FIELDS;
	final String DATABASE_CREATE_SELF = SQL_CREATE + SELF_TABLE + SELF_FIELDS;
	final String FAVORITE_CLIENTS = SQL_CREATE + CONTACTS_TABLE
			+ CONTACTS_FIELDS;
	final String FAVORITE_NOTIFICATIONS = SQL_CREATE + NOTIFICATIONS_TABLE
			+ NOTIFICATIONS_FIELDS;

	final String DATABASE_DROP_IN = "DROP TABLE IF EXISTS " + IN_TABLE;
	final String DATABASE_DROP_OUT = "DROP TABLE IF EXISTS " + OUT_TABLE;
	final String DATABASE_DROP_SELF = "DROP TABLE IF EXISTS " + SELF_TABLE;
	final String DATABASE_DROP_CLIENTS = "DROP TABLE IF EXISTS "
			+ CONTACTS_TABLE;
	final String DATABASE_DROP_NOTIFICATIONS = "DROP TABLE IF EXISTS "
			+ NOTIFICATIONS_TABLE;

	final String DATABASE_DELETE_IN = "DELETE FROM " + IN_TABLE;
	final String DATABASE_DELETE_OUT = "DELETE FROM " + OUT_TABLE;
	final String DATABASE_DELETE_SELF = "DELETE FROM " + SELF_TABLE;
	final String DATABASE_DELETE_CONTACTS = "DELETE FROM " + CONTACTS_TABLE;
	final String DATABASE_DELETE_NOTIFICATIONS = "DELETE FROM " + NOTIFICATIONS_TABLE;

	/**
	 * Regular Expressions
	 * 
	 */
	final String MAIL_PATTERN = "^([0-9a-zA-Z]+[-._+&amp;])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$";
	final String PHONE_PATTERN = "^[0][0][2][0][1][0-9]{9,9}$";
	final String NAME_PATTERN = "^[0-9a-zA-Z]+[a-zA-Z]*$";

}
